<template>
	<el-container v-loading="loading">
		<el-container>
			<el-header>
				<div class="left-panel">
				</div>
				<div class="right-panel">
					<div class="right-panel-search">
						<el-input v-model="search.patient_sn" placeholder="问诊单号" clearable></el-input>
						<el-select v-model="search.status" placeholder="监管同步状态" style="min-width:15%;width:300px;" clearable>
							<el-option v-for="item in statusList" :key="item.status" :label="item.status_name"
									   :value="item.status">
							</el-option>
						</el-select>
						<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
						<el-button type="info" @click="resetsearch">重置</el-button>
					</div>
				</div>
			</el-header>
			<el-main class="nopadding">
				<scTable ref="table" :apiObj="apiObj" @selection-change="selectionChange" :params="search" stripe
						 remoteSort
						 remoteFilter>
					<el-table-column label="同步时间" prop="created_at"></el-table-column>
					<el-table-column label="问诊单号" prop="patient_sn"></el-table-column>
					<el-table-column label="监管同步状态" prop="status_name"></el-table-column>
					<el-table-column label="备注" prop="remark"></el-table-column>
				</scTable>
			</el-main>
		</el-container>
	</el-container>
</template>

<script>
export default {
	name: 'syncOrder',
	components: {},
	data() {
		return {
			dialog: {
				save: false
			},
			showGroupLoading: false,
			loading: false,
			apiObj: this.$API['patient.patient_order'].syncList,
			selection: [],
			statusList: [
				{status: 0, status_name: "全部"},
				{status: 1, status_name: "未同步"},
				{status: 2, status_name: "同步成功"},
				{status: 3, status_name: "同步失败"},
			],
			patient_sn: '',
			search: {
				patient_sn: this.$route.query.patient_sn,
				status: null,
			},
		}
	},
	watch: {},
	mounted() {
		this.patient_sn = this.$route.query.patient_sn;
		if (this.patient_sn) {
			this.search.patient_sn = this.patient_sn;
		}
	},
	methods: {
		//搜索
		upsearch() {
			this.$refs.table.upData(this.search)
		},
		//重置
		resetsearch() {
			this.search = {
				patient_sn: null,
				status: 0,
			}
			this.$refs.table.upData(this.search)
		}
	}
}
</script>
